import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Class that displays the life the Player still have.
 * 
 * @author Manel nava
 * @version 1.0
 */
public class Life extends Actor
{
    
    private int lifePoints;
    
    /**
     * The constructor of the class receives the lifes the Player still have.
     */
    public Life(int d)
    {
        lifePoints=d;
        setHearts();
    }
    
    /**
     * Method that sets the image the actor will have.
     */
    public void setHearts()
    {
        switch(lifePoints)
        {
            case 4: setImage(new GreenfootImage("heartFull.png"));
            break;
            case 3:setImage(new GreenfootImage("heart23.png"));
            break;
            case 2:setImage(new GreenfootImage("heart13.png"));
            break;
            case 1:setImage(new GreenfootImage("heartEmpty.png"));
            break;
        }
    }
    
    /**
     * return the number of lifes stored in the variable lifePoints.
     */
    public int getLifePoints()
    {
        return lifePoints;
    }
    
    /**
     * The method act in this class is empty.
     */
    public void act() 
    {
        // Add your action code here.
    } 
    
    
}
